<?php
function getRealIpAddr(){
	if (!empty($_SERVER['HTTP_CLIENT_IP'])){  //查询局域网下的IP地址
		$ip=$_SERVER['HTTP_CLIENT_IP'];
	} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){//检查 ip 是否是代理传递
		$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
	}else{
		$ip=$_SERVER['REMOTE_ADDR'];
	}
	return $ip;
}                 //获取访问者IP自定义函数 getRealIpAddr()
